package com.fjec.common.config;

import com.fjec.common.redis.RedisGenIdHelper;
import com.fjec.common.redis.Timer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.integration.redis.util.RedisLockRegistry;

@Configuration
@Order(2147483647)
public class CommonHelperConfig {

    @Bean
    public RedisGenIdHelper redisGenIdHelper(RedisTemplate redisTemplate,
                                             RedisLockRegistry redisLockRegistry) {
        return new RedisGenIdHelper(redisTemplate, redisLockRegistry);
    }

    @Bean
    public Timer timer(RedisGenIdHelper redisGenIdHelper) {
        return new Timer(redisGenIdHelper);
    }
}
